<style type="text/css">
.content{position:relative}
.content .large{position:absolute;top:60px;left:50%;margin-left:-47px;width:95px;height:95px;border-radius:50%;background-color:#f4e3cd;-webkit-animation-name:largeAnimation;-webkit-animation-duration:2s;-webkit-animation-timing-function:ease-out;-webkit-animation-iteration-count:infinite;-webkit-animation-direction:normal}
.content .middle{position:absolute;width:95px;top:60px;left:50%;margin-left:-47px;height:95px;border-radius:50%;background-color:#fad099;-webkit-animation-name:middleAnimation;-webkit-animation-duration:2s;-webkit-animation-timing-function:ease-out;-webkit-animation-iteration-count:infinite;-webkit-animation-direction:normal}
.content .small{position:absolute;top:60px;left:50%;margin-left:-47px;width:95px;height:95px;border-radius:50%;background-color:#fd8926;display:-webkit-box;-webkit-box-align:center;-webkit-box-pack:center}.content .small p{color:#fff;font-size:12px;text-align:center;line-height:26px}
.content .small p span{font-size:27px;padding-top:10px}@-moz-keyframes middleAnimation{0%{-webkit-transform:scale(1)}100%{-webkit-transform:scale(1.63)}}@-webkit-keyframes middleAnimation{0%{-webkit-transform:scale(1)}100%{-webkit-transform:scale(1.63)}}@-o-keyframes middleAnimation{0%{-webkit-transform:scale(1)}100%{-webkit-transform:scale(1.63)}}@keyframes middleAnimation{0%{-webkit-transform:scale(1)}100%{-webkit-transform:scale(1.63)}}@-moz-keyframes largeAnimation{0%{-webkit-transform:scale(1)}100%{-webkit-transform:scale(2.21)}}@-webkit-keyframes largeAnimation{0%{-webkit-transform:scale(1)}100%{-webkit-transform:scale(2.21)}}@-o-keyframes largeAnimation{0%{-webkit-transform:scale(1)}100%{-webkit-transform:scale(2.21)}}@keyframes largeAnimation{0%{-webkit-transform:scale(1)}100%{-webkit-transform:scale(2.21)}}
</style>
<div class="fui-page order-create-page fui-page-current" style="margin-top:2.5rem">
	<div class="fui-content  navbar">
		<div class="fui-title-c" onclick="wait_driver()" ng-show="pagedata.info.show==0">
			<div class="weui_icon_area">
				<div class="content">
					<div class="large"></div>
					<div class="middle"></div>
					<div class="small">
						<p>听单中
						<br><span class="time j_timeClock">0:0:0</span></p>
					</div>
				</div>
			</div>
		</div>
		<div class="weui_cells" style="margin:2%" ng-show="pagedata.info.show==1">
			<div class="weui_cell" id="r-result">
				<div class="weui_cell_bd weui_cell_primary">客户姓名:</div>
				<div class="weui_cell_ft" >{{pagedata.info.name}}</div>
			</div>
			<div class="weui_cell" id="r-result">
				<div class="weui_cell_bd weui_cell_primary">联系电话:</div>
				<div class="weui_cell_ft" >{{pagedata.info.mobile}}</div>
			</div>
			<div class="weui_cell" id="r-result">
				<div class="weui_cell_bd weui_cell_primary">出发点:</div>
				<div class="weui_cell_ft" >{{pagedata.info.start_seat}}</div>
			</div>
			<div class="weui_cell" id="r-result">
				<div class="weui_cell_bd weui_cell_primary">目的地:</div>
				<div class="weui_cell_ft" >{{pagedata.info.dest_seat}}</div>
			</div>
			<div class="fui-icon-group noborder col-3">
                <a class="fui-icon-col external" href="">
					<div class="text" style="color: #666666;">行程距离</div>
                    <div class="icon"><i class="icon jinyunicon icon-ditu"/></div>
                    <div class="text" style="color: #F60;">{{pagedata.info.juli || '2'}}公里</div>
                </a>
                <a class="fui-icon-col external" href="">
					<div class="text" style="color: #666666;">预计时间</div>
                    <div class="icon"><i class="icon jinyunicon icon-shijian"/></div>
                     <div class="text" style="color: #F60;">{{pagedata.info.time || '20'}}分钟</div>
                </a>
                <a class="fui-icon-col external" href="" data-nocache="true">
					<div class="text" style="color: #666666;">预计价格</div>
                    <div class="icon"><i class="icon jinyunicon icon-goumai"/></div>
                    <div class="text" style="color: #F60;">￥{{pagedata.info.price || '0.00'}}元</div>
                </a>
			</div>
			<div class="fui-btn-group col-2">
				<a class="fui-btn-col external" href="javascript:" ng-click="post(pagedata.info,'ok')" style="padding:10px;background:#f60;color:#fff">接单</a>
				<a class="fui-btn-col external" href="javascript:" ng-click="post(pagedata.info,'no')" style="padding:10px;background:#333;color:#fff">拒绝</a>
			</div>
		</div>
	</div>
</div>
<div ng-include="sys_html('_menu')"></div>
<script type="text/javascript">
if(scope.pagedata.info.show==0){
		var wating_time = 0;
		var hour = 0;
		var min = 0;
		var sec = 0;
		var isnew = false;
		function addTime(){
			wating_time = 0;
			timer = setInterval(function(){
				wating_time = wating_time + 1;
				hour = parseInt(wating_time / (60*60));
				min = parseInt((wating_time-hour * 60*60) / (60));
				console.log(wating_time);
				if(wating_time>=60){
					sec = wating_time % 60;
				}else{
					sec = wating_time;
				}
				$('.j_timeClock').html(hour+':'+min+':'+sec);
			},1000);
		}
		addTime();
}
window.scope.location(function(res){
		scope.$apply(function(){
			scope.pagedata.info.address = res.address;
			scope.pagedata.info.lat = res.lat_lng;
			
		});
		var params = {
					'plugin':'jy_taxi',
					'action':'d_wait',
					'op':'dw',
					'data':{
						'latlng':res.lat_lng
					},
					'callback':function(data){
							
					}
		}
		scope.post_json(params);
	
});
wait_driver();

require(['jinyun_socket'],function(jinyun_socket){
	jinyun_socket.connect();
	jinyun_socket.onsystem=function(res){
		$("#musicClick")[0].play();
		var info = JSON.parse(res.message);
		scope.pagedata.info.show = 1;
			scope.pagedata.info.mobile = info.mobile;
			scope.pagedata.info.name = info.name;
			scope.pagedata.info.time = info.time;
			scope.pagedata.info.jjuli = info.jjuli;
			scope.pagedata.info.juli = info.juli;
			scope.pagedata.info.price = info.price;
			scope.pagedata.info.orderid =info.orderid;
			scope.pagedata.info.start_seat=info.chufa;
			scope.pagedata.info.dest_seat=info.mudi;
			scope.$evalAsync();
	}
});
/*
var ws = new WebSocket('ws://forward.jinyunweb.com:8888');
var message_pre=scope.pagedata.message_pre1;//将后端传来的消息前缀存入变量备用
ws.onopen = function(){
    var message = message_pre+'0;success';//0表示发送心跳
    ws.send(message);
};
ws.onmessage = function(e){
    //接收来自云平台的消息并处理
    var data=e.data.split(';');
    var from_uid=data['0'];
    if(from_uid == 0){
	//alert(data['1']);
        //0表示系统消息，例如转发消息时，系统会推送一个转发结果回来
    }else{
		var info = JSON.parse(data['1']);
		alert(data['1']);
		scope.$apply(function(){
			scope.pagedata.info.show = 1;
			scope.pagedata.info.mobile = info.mobile;
			scope.pagedata.info.name = info.name;
			scope.pagedata.info.time = info.time;
			scope.pagedata.info.jjuli = info.jjuli;
			scope.pagedata.info.juli = info.juli;
			scope.pagedata.info.price = info.price;
			scope.pagedata.info.order =info.orderid;
			scope.pagedata.info.start_seat=info.chufa;
			scope.pagedata.info.dest_seat=info.mudi;				
		});
    }
}*/
//发送消息给指定用户
//var message=message_pre+'2;你好';//把“你好”这条消息发送给ID为2的用户
//ws.send(message);	
function wait_driver(){
	scope.count_down(60,'wait_min','秒','点击重新呼叫司机');
}
</script>